package java_test.mtthod;

public class MethodFactorial {
    public static void main(String[] args) {
        for (int i = 0; i <= 10; i++) {
            System.out.println(i + "的阶乘为" + factorial(i));
        }
    }

    private static int factorial(int i) {
        if (i <= 1) {
            return 1;
        } else {
            return i * factorial(i - 1);
        }
    }
}
